# -*- coding: utf-8 -*-
"""
推荐系统 - Django Admin配置
"""

from django.contrib import admin
from .models import UserActivityView, UserInterestTag


@admin.register(UserActivityView)
class UserActivityViewAdmin(admin.ModelAdmin):
    """用户浏览记录管理"""
    list_display = ('user', 'activity', 'view_count', 'duration', 'source', 'has_interaction', 'last_viewed_at')
    list_filter = ('source', 'has_interaction', 'device_type', 'last_viewed_at')
    search_fields = ('user__username', 'activity__title')
    raw_id_fields = ('user', 'activity')
    ordering = ('-last_viewed_at',)


@admin.register(UserInterestTag)
class UserInterestTagAdmin(admin.ModelAdmin):
    """用户兴趣标签管理"""
    list_display = ('user', 'tag_name', 'weight', 'from_views', 'from_registrations', 'from_comments', 'updated_at')
    list_filter = ('updated_at',)
    search_fields = ('user__username', 'tag_name')
    raw_id_fields = ('user',)
    ordering = ('-weight',)
